let initState = {
  name: 'init',
  age: 0
}

export default function infoReducer(state, action) {
  if(!state) {
    state = initState
  }
  switch (action.type) {
    case 'SETNAME':
      return {
        ...state,
        name: action.name
      }
    case 'SETAGE':
      return {
        ...state,
        age: action.age
      }
    default: 
      return state
  }
}